python
def is_prime(num):
    if num < 2:
return False
for i in range(2, int(num ** 0.5) + 1):
if num % i == 0:
return False
return True

def closest_prime_number(words):
numbers = {'zero': '0', 'one': '1', 'two': '2', 'three': '3', 'four': '4', 'five': '5', 'six': '6', 'seven': '7', 'eight': '8', 'nine': '9'}
number_str = ''.join(numbers[word] for word in words.split())

if not number_str.isdigit() or len(number_str) != 3:
return "Wrong input"

number = int(number_str)

a = number
b = number
while True:
if is_prime(a):
return str(a)
if is_prime(b):
return str(b)
a -= 1
b += 1


words = input("Введите три слова: ")
result = closest_prime_number(words)
print(result)
